From: emellor@ewan Date: Tue, 27 Sep 2005 14:10:38 +0000 (+0100) Subject: This patch adds a quick check to 'xm restore' that checks the X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16769^2~16^2~32^2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=0fae7b55e59313fe8f85b870958c8b9308922195;p=xen.git This patch adds a quick check to 'xm restore' that checks the existence and readability of the file given. This fixes the issue detected in xm-tests 03_restore_badparm_neg and 04_restore_badfilename_neg. Signed-off-by: Dan Smith Signed-off-by: Ewan Mellor --- diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py index 0db2e8636d..648c5968a7 100644 --- a/tools/python/xen/xm/main.py +++ b/tools/python/xen/xm/main.py @@ -188,6 +188,10 @@ def xm_restore(args): savefile = os.path.abspath(args[0]) + if not os.access(savefile, os.R_OK): + err("xm restore: Unable to read file %s" % savefile) + sys.exit(1) + from xen.xend.XendClient import server info = server.xend_domain_restore(savefile) PrettyPrint.prettyprint(info)